<html>
<head><title>Test METAR</title></head>
<body>
<font size="-1">
<?php


// you may need to uncomment the following line, depending on how you compiled the sqlite3 extension.
// dl('sqlite3.so');


$db = sqlite3_open("/db/wg3.db");
if (!$db) die ("Could not open database..");


$query = sqlite3_query($db, "select * from (select timestamp,cycle,code from metar where station_id = 'CYEG' and code is not null order by timestamp desc limit 5) order by timestamp; ") ;
if (!$query) die (sqlite3_error($db));
while ( ($row = sqlite3_fetch_array($query)))
{
	printf("%s %s <br>\n", $row['cycle'], $row['code']);
}
sqlite3_query_close($query);


print("<hr>\n") ;

$query = sqlite3_query($db, "select * from (select timestamp,cycle,code from metar where station_id = 'CYOJ' and code is not null order by timestamp desc limit 5) order by timestamp; ") ;
if (!$query) die (sqlite3_error($db));
while ( ($row = sqlite3_fetch_array($query)))
{
	printf("%s %s <br>\n", $row['cycle'], $row['code']);
}
sqlite3_query_close($query);





//  do not forget to release all handles !
sqlite3_close ($db);

?>

</font>
</body>
</html>
